<?php
namespace app\seller\controller;

class Login
{
    public function index()
    {
		session(null);
		$data = array(
			'msg' => ''
		);
		if(request()->isPost()){
			
			$phone = input('post.phone');
			$password = input('post.password');
			$user = db('user')->where(['phone'=>$phone,'password'=>md5($password),'type'=>1])->find();			
			if($user){
				session("wmo2o_u_uid",(string)$user['id']);	
				session("wmo2o_u_phone",(string)$user['phone']);
				session("wmo2o_u_type",(string)$user['type']);
				session("wmo2o_u_time",(string)time());				
				redirect(url('/seller/index'));
				exit();
			}else{
				$data['msg'] = lang('Login_error');
			}
		}
		$config = db('webconfig')->where('id',1)->find();
		config('website',$config);
        return view('',['data'  => $data,'config'=>$config]);
    }
}
